/*
 * @Author: DUST
 * @Date: 2023-05-16 11:16:21
 * @LastEditors: DUST
 * @LastEditTime: 2023-11-28 11:35:58
 * @FilePath: \business-card-system\admin\src\interface\index.ts
 * @Description:
 * undefined
 */
import { RouteComponent } from "vue-router";

/**
 * @description: config配置文件
 */
export interface Config {
  baseurl: string;
  primaryColor: string;
  successCode: Array<string | number>;
  projectName: string;
  authKey: string;
  outDir: string;
  isProd: boolean;
  [propName: string]: any;
}

export interface UserInfo {
  nikname: string;
  unitId: number;
  id: number;
  [other: string]: any
}

/**
 * @description: 路由接口
 */

/**
 * Allowed Component definitions in route records provided by the user
 */
declare type Lazy<T> = () => Promise<T>;
export declare type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
export interface RouteMenuInterface {
  path: string;
  name?: string;
  component: RawRouteComponent;
  compoennts?: Record<string, RawRouteComponent>;
  meta: {
    title: string;
    key: string;
    isNotNeedLogin?: boolean;
    noShow?: boolean;
  };
  children?: RouteMenuInterface[];
}
/**
 * @description: 表格column
 */
export interface tableColumn {
  title: string;
  dataIndex: string;
  width?: number | string;
  [propsName: string]: any;
}
/**
 * @description: 分页数据
 */
export interface PageInterFace {
  pageSize?: number;
  pageNumber?: number;
  current?: number;
  total?: number;
  [propsName: string]: any;
}
/**
 * @description: 请求返回数据格式
 */
export interface Ajax<T> {
  code: string;
  data: T;
  msg: string;
}
/**
 * @description: 表格数据基本格式
 */
export interface PageRes<T> {
  endRow: number;
  hasNextPage: boolean;
  hasPreviousPage: boolean;
  isFirstPage: boolean;
  isLastPage: boolean;
  list: Array<T>;
  navigateFirstPage: number;
  navigateLastPage: number;
  navigatePages: number;
  navigatepageNums: Array<number>;
  nextPage: number;
  pageNum: number;
  pageSize: number;
  pages: number;
  prePage: number;
  size: number;
  startRow: number;
  total: number;
}
export interface IButton {
  name: string;
  type?: string;
  isShow?: boolean;
  func: (...args: any) => void | null;
}

//sort接口
export interface SortInterFace {
  column?: {
    title: string;
    dataIndex: string;
    sorter: boolean;
    [string: string]: any;
  };
  columnKey?: string;
  field?: string;
  order?: "ascend" | "descend";
}

export interface TokenData {
  actionPower: number;
  adminType: number;
  id: number;
  menuPower: string | null;
  timeStamp: number;
  token: string;
  unitId: number;
}
